//package com.lsl.config;
//
//import com.lsl.filter.MyFilter;
//import com.lsl.interceptor.MyInterptor;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//@Configuration
//public class MyConfig implements WebMvcConfigurer {
//    @Autowired
//    private MyInterptor myInterptor;
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(myInterptor).addPathPatterns("/**").excludePathPatterns("/userlogin","/","/index","/login2","login");
//        registry.addInterceptor(myInterptor).addPathPatterns("/**").excludePathPatterns("/userlogin","/","/index","/login2","login");
//    }
//
//    @Bean
//    public FilterRegistrationBean testFilterRegistration(MyFilter myFilter) {
//        FilterRegistrationBean registration = new FilterRegistrationBean();
//        registration.setFilter(myFilter);//添加过滤器
//        registration.addUrlPatterns("/show");//设置过滤路径，/*所有路径
//        //registration.addInitParameter("name", "alue");//添加默认参数
//        registration.setName("MyFilter");//设置优先级
//        registration.setOrder(1);//设置优先级
//        return registration;
//    }
//
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
//    }
//}
